//
//  V2Common.h
//  v2ex-iOS
//
//  Created by longcheng on 16/5/16.
//  Copyright © 2016年 Singro. All rights reserved.
//

#ifndef JrdCommon_h
#define JrdCommon_h

//Common View
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define STATUS_BAR_HEIGHT (20)
#define NAVIGATION_BAR_HEIGHT (44)

//MyStudy View Controller
#define STUDY_VIEW_SCROLLY_H (200)
#define STUDY_VIEW_SECTION_H (40)
#define STUDY_VIEW_SEGMENT_W   (SCREEN_WIDTH-20)
#define STUDY_VIEW_SEGMENT_H   (30)
#define JRD_COURSE_TABLE_H  (72)
#define JRD_COURSE_SECTION_H  (30)

//Offline View Controller
#define SWITCH_BAI_HEIGHT   (40)
#define OFFLINE_ITEM    (2)

//table view
#define V2_TABLE_REFERSH_HEIHT (0)
#define V2_TABLE_TOP_VIEW      (0)

//Me
#define V2_ME_TABLE_COUNT   (2)

//Settings
#define V2_SETTING_TABLE_COUNT (4)

//CycleScrollView
#define JRD_CYCLE_SCROLL_H  (200)


//Course cell define
#define JRD_COURSE_CELL_IMG_W   (52)
#define JRD_COURSE_CELL_IMG_H   (52)

//course center
#define JRD_COURSE_SEG_W    (SCREEN_WIDTH - 10)
#define JRD_COURSE_SEG_H    (35)

//RGB
#define V2_RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define JRD_RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

#define L_MIN 0
#define L_COURSE 1
#define L_R_SCORE 2
#define L_E_SCORE 3
//Course Center type
#define JRD_COURSE_LASTEST (0)
#define JRD_COURSE_MOST_POPULAR (2)
#define JRD_COURST_RECOMMEND    (1)
#endif /* V2Common_h */

#define JrdNavigationBarColor   JRD_RGB(255,255,255)//JRD_RGB(48,129,255)//JRD_RGB(67, 199, 176)
#define JrdSelectColor          JRD_RGB(197,216,237)//JRD_RGB(48, 187, 255)//JRD_RGB(46, 158, 138)
#define JrdSeparateColor         JRD_RGB(200, 199, 204)
#define JrdBackgroundColor      JRD_RGB(255, 255, 255)
#define JrdWhite1Color          JRD_RGB(255,255,255)
#define Jrd9BColor              JRD_RGB(155,155,155)
#define JrdSpeLineColor         JRD_RGB(231, 231, 231)
#define JrdSpeLineColorExt       JRD_RGB(220, 220, 220)

#define JrdTableHeadColor          JRD_RGB(244,244,244)
#define JrdBlackColor              JRD_RGB(0,0,0)
#define JrdLoginBackColor          JRD_RGB(211 ,27,33)
#define JrdGrayColor               JRD_RGB(200, 200, 200)

#define JrdGreenColor               JRD_RGB(104, 228, 61)

#define JRD_TABLE_CELL_HEIGHT   (50)
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;

#define UID @"4597633"
#define VERSION @"2.4.1.2"


#define JRD_TABLE_LEARN_STA_CELL_HEIGHT (90)
#define JRD_LEARN_STA_X (20)
#define JRD_LEARN_ICON_W    (90)
#define JRD_LEARN_ICON_H    (90)

#define JrdLearnMinColor    JRD_RGB(105, 178, 254)
#define JrdFinishCourseColor    JRD_RGB(100, 205, 114)
#define JrdScoreReuColor    JRD_RGB(206, 15, 27)
#define JrdScoreDelColor    JRD_RGB(169, 169, 169)

#define JrdCourseType_1     (1)
#define JrdCourseType_2     (2)
#define JrdQuestionCount    (1)
static NSString * const kReloadDataNotification = @"kReloadDataNotification";
static NSString * const kReloadUserNotification = @"kReloadUserNotification";
static NSString * const kGotoMyLearnNotification = @"kGotoMyLearnNotification";

static NSString* const kUpdateDownloadInfoNotification = @"kUpdateDownloadInfoNotification";
static NSString* const kDeleteCacheNotification = @"kDeleteCacheNotification";
static NSString* const kSelectCourseNotification= @"kSelectCourseNotification";
static NSString* const kPickImageNotification= @"kPickImageNotification";
static NSString* const kCheckValue=@"kCheckValue";
typedef enum {
    COURSE_USER = 0,
    COURSE_ID,                                    //仅仅初始化未做任何操作(既未加入任务队列中)
    COURSE_NAME,                                    //等待下载已加入任务队列但未开始
    COURSE_DES,                                 //正在下载
    COURSE_CATEGORY,                                   //暂停 已存在任务队列中 属于挂起状态
    COURSE_STARTDATE,                                  //取消任务
    COURSE_ENDDATE,
    COURSE_ICON_URL,
    COURSE_IS_OPERATED,
    COURSE_IS_SELECT
}CourseList;

typedef enum {
    NODE_ID = 0,                                    //仅仅初始化未做任何操作(既未加入任务队列中)
    NODE_USER_ID,
    NODE_NAME,                                    //等待下载已加入任务队列但未开始
    NODE_AUDIO_URL,                                 //正在下载
    NODE_DOC_URL,                                   //暂停 已存在任务队列中 属于挂起状态
    NODE_TYPE,                                  //取消任务
    NODE_PARENTID,
    NODE_TOTAL_TIME,
    NODE_STUDY_TIME,
    NODE_IS_DOWNLOAD,
    NODE_DOWNLOAD_URL,
    NODE_LEVEL_ID
}NodeList;

typedef enum{
    DOWNLOAD_NONE,
    DOWNLOAD_AUDIO,
    DOWNLOAD_PDF
}DownloadStatus;

typedef enum{
    QUESTION_ID=0,
    QUESTION_USER_ID,
    QUESTION_NODR_ID,
    QUESTION_USER_ANSWER,
    QUESTION_VALUE
}QuestionList;
typedef enum {
    ENTER_FROM_NORMAL = 0,
    ENTER_FROM_DOWNLOAD,
    ENTER_FROM_VIEWONLY
}ENTERTYPE;
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)  
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

#define CAPTCHA_START 1
#define CAPTCHA_END   0
#define JRD_CHECK_VALUE 2
